<?php
/**
 * // +----------------------------------------------------------------------
 * //            -------------------------
 * //           /   / ------------------\  \
 * //                                          \  \
 * //                                           /  /
 * //          /  /  ------------------- /  /
 * //        /  /  ----------------------
 * //      /  /
 * //      \  \
 * //        \  \  ------------------ /  /
 * //          \  \--------------------/
 * // +----------------------------------------------------------------------
 * // | Copyright (c) 2016 Sage  All rights reserved.
 * // +----------------------------------------------------------------------
 * // | Author: Sage
 * // +----------------------------------------------------------------------
 *
 */

namespace KysbsUtils\Traits;
/**
 * Created by PhpStorm.
 * User: Sage
 * Date: 2017/7/28
 * Time: 11:58
 */
trait CallStaticTrait {
    /**
     * 调用不存在静态方法
     * @param $name
     * @param $arguments
     *
     * @return mixed
     * @throws \Exception
     */
    public static function __callStatic($name , $arguments) {
        if(method_exists(self::getInstance(),$name)){
            return self::getInstance()->$name(...$arguments);
        }else{
            throw new \Exception('static method not exist');
        }
    }
}